
varpool = None

class VariablePool:
    def __init__(self):
        self.vardict = {}
        
    def NewName(self):
        return "Data%d" % len(self.vardict)
        
    def AddVariable(self, var, autoname = True):
        if var.HasName():
            self.vardict[var.Name] = var
        else:
            var.Name = self.NewName()
            self.vardict[var.Name] = var
        
    def HasVariable(self, name):
        return self.vardict.has_key(name)
    
    def GetVariable(self, name):
        return self.vardict[name]
    
    def Print(self):
        for k, v in self.vardict.items():
            print "%s:%s" % (k, repr(v))
            
    def __getattr__(self, name):
        return self.vardict[name]
    
if __name__ == '__main__':
    vp = VariablePool()
    print vp.__dict__